home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / BKISSSRC.ZIP / SLIDETXT / DRAWSTRX.INC next >
Encoding:
Text File  |  1994-02-04  |  3.5 KB  |  84 lines

  1. TransparentText = 1     ;set to 0 to draw backgrounds of letters
  2. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  3. ; void far Draw_String(byte far *fontdata, byte far *string,
  4. ;                  word xcoord, word ycoord, word pageoffs);
  5. ;
  6. PROC            _Draw_String far
  7.                 push bp
  8.                 mov bp,sp
  9.                 push ds
  10.  
  11.                 mov ax,0A000h
  12.                 mov es,ax
  13.  
  14.                 lds si,[dword bp + 6]               ; DS:SI -> fontdata
  15.                 add si,3                            ; point to offset table
  16.                 mov dx,[bp + 14]                    ; X coord
  17.  
  18.                 mov di,[bp + 16]                    ; Y coord
  19.                 shl di,4                            ; *16
  20.                 mov bx,di                           ; save
  21.                 shl di,2                            ; *64
  22.                 add di,bx                           ; *64 + *16 = *80
  23.                 shl di,2
  24.  
  25.                 mov cl,dl                   ; get plane bits from X pos
  26.                 and cl,00000011b            ; keep in 0-3 range
  27.                 mov ah,00010001b            ; start at plane 0
  28.                 rol ah,cl                   ; shift to proper plane
  29.  
  30.                 shr dx,2                    ; divide X coord by 4
  31.                 add di,dx                   ; video offset to start at
  32.                 add di,[bp + 18]            ; final video offset
  33.  
  34.                 lfs bx,[dword bp + 10]      ; FS:BP -> string
  35.                 mov bp,bx
  36.                 mov al,02h                          ; 02h = map mask index
  37.  
  38. @@setupletter:  xor bh,bh
  39.                 mov bl,[byte fs:bp]                 ; load letter from message
  40.                 shl bx,1                            ; *2 = word sized
  41.  
  42.                 mov cx,[word si + bx]
  43.                 mov gs,si                           ; save font pointer
  44.                 sub si,3                            ; back to start
  45.                 add si,cx                           ; point to proper spot in font file
  46.  
  47.                 mov ch,[byte si + 1]                ; get X size
  48.                 mov cl,[byte si + 2]                ; get Y size
  49.                 jcxz @@nextcharacter
  50.                 add si,03h                          ; point to start of data
  51.  
  52. @@newplane:     mov dx,03c4h                        ; sequencer reg
  53.                 out dx,ax
  54.                 mov dl,cl                           ; loop Y count
  55.  
  56.                 mov bx,di                           ; save video pointer
  57. @@drawcolumn:   mov dh,[byte si]                    ; draw a column
  58.                 if TransparentText ne 0
  59.                     or dh,dh
  60.                     jz @@dontplot
  61.                 endif
  62.                 mov [es:di],dh
  63. @@dontplot:     inc si                              ; next byte in column
  64.                 add di,80*4                         ; next video line
  65.                 dec dl                              ; decrement height
  66.                 jnz @@drawcolumn
  67.                 mov di,bx                           ; restore video pointer
  68.  
  69.                 rol ah,1
  70.                 adc di,0
  71.                 dec ch
  72.                 jnz @@newplane
  73.  
  74. @@nextcharacter:mov si,gs
  75.                 inc bp                              ; next letter in message
  76.                 cmp [byte fs:bp],00h
  77.                 jne @@setupletter
  78.  
  79.                 pop ds
  80.                 pop bp
  81.                 ret
  82. ENDP            _Draw_String
  83. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  84.